<%-- 
    Document   : indexnew
    Created on : Jan 10, 2013, 7:21:13 AM
    Author     : rzclau
--%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.ArrayList"%>
<%@page import="model.KostumBean"%>
<%@page import="database.DBKostum"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Custome-izer</title>
</head>
<body>
    

<h1>Kostum list</h1>
<table cellpadding="5" border=1>

  <tr valign="bottom">
    <td align="left"><b>Description</b></td>
    <td align="left"><b>Price</b></td>
    <td align="left"><b>Kategori</b></td>
  </tr> 
  
<% 
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/rbpl", "root", "");
        Statement s = conn.createStatement();
        
        try{
            String q = "select ID_Kostum, NamaKostum, Harga,Kategori from daftar_kostum";
            int d = 0;
            int x = 0;
            ArrayList<String> ss = new ArrayList<String>();
            
            ResultSet h = s.executeQuery(q);
            while(h.next()){
                d++;
                ss.add(String.valueOf(d));
                out.println(ss.get(x));
                out.print("<tr>");
                out.print("<td>"+ h.getString("NamaKostum") +"</td>");
                out.print("<td>"+ h.getString("Harga") +"</td>");
                out.print("<td>"+ h.getString("Kategori") +"</td>");
                out.print("<td>");
                out.println("<a href='cart.jsp?productCode="+ h.getString("ID_Kostum")+"'>Add To Cart</a>");
                out.println("</td>");
                out.print("</tr>");
                x++;
                
            }
        }
        catch(Exception e){
            e.printStackTrace();
        }
        
%>

</table>
</body>
</html>